package com.companion.companion.controller;

import java.util.List;

import com.companion.companion.domain.Carerecord;
import com.companion.companion.service.ICarerecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 护工陪护记录Controller
 * 
 * @author zly
 * @date 2025-05-06
 */@CrossOrigin
@RestController
@RequestMapping("/system/carerecord")
public class CarerecordController
{
    @Autowired
    private ICarerecordService carerecordService;

    /**
     * 查询护工陪护记录列表
     */
    @GetMapping("/list")
    public List<Carerecord> list(Carerecord carerecord)
    {
        return carerecordService.selectCarerecordList(carerecord);
    }

    /**
     * 获取护工陪护记录详细信息
     */
    @GetMapping(value = "/{careRecordId}")
    public Carerecord getInfo(@PathVariable("careRecordId") Long careRecordId)
    {
        return carerecordService.selectCarerecordByCareRecordId(careRecordId);
    }

    /**
     * 新增护工陪护记录
     */
    @PostMapping
    public int add(@RequestBody Carerecord carerecord)
    {
        return carerecordService.insertCarerecord(carerecord);
    }

    /**
     * 修改护工陪护记录
     */
    @PutMapping
    public int edit(@RequestBody Carerecord carerecord)
    {
        return carerecordService.updateCarerecord(carerecord);
    }

    /**
     * 删除护工陪护记录
     */
    @DeleteMapping("/{careRecordIds}")
    public int remove(@PathVariable Long[] careRecordIds)
    {
        return carerecordService.deleteCarerecordByCareRecordIds(careRecordIds);
    }
}
